package
{
	import com.junkbyte.console.Cc;

	import flash.display.Loader;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;

	[SWF(frameRate = "60", width = "1024", height = "768", backgroundColor = "#ffffff")]
	public class Main extends Game
	{
		public function Main()
		{
			Cc.debug("Main init!");

			GameDispatcher.instance.addEventListener(GameEvent.ADD_CYCLE_FUNCTION, function(event:GameEvent):void
			{
				trace(event.data)
			});

			var appDomainB:ApplicationDomain = ApplicationDomain.currentDomain;
			var contextB:LoaderContext = new LoaderContext(false, appDomainB);
			var loaderB:Loader = new Loader();
			loaderB.load(new URLRequest("modules/module1.swf"), contextB);
			var loaderA:Loader = new Loader();
			loaderA.load(new URLRequest("modules/module2.swf"), contextB);

			loaderB.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event:Event):void
			{
				addChild(loaderB.contentLoaderInfo.content);
			});
		}
	}
}
